<?
    /* -*- Mode: PHP5; tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- */
    
    /*********************************************************
    *            --== InArch ==--
    *
    * Ajax Drop Node
    *
    * @author Kulikov Alexey <a.kulikov@gmail.com>
    * @version n/a
    * @since 25.05.2005
    * @copyright essentialmind.com 2005
    *
    *********************************************************/

    /***
    * class ajaxDropNode
    ****
    * This class will create drop a node via an AJAX method
    ****
    * @package ajax
    * @author A Kulikov <a.kulikov@gmail.com>
    * @version n/a
    * @since 25.05.2005
    * @copyright essentialmind.com 2005
    ***/
    class ajaxDropNode extends ajaxAction{

        public function process(){
            $id = (int)$_REQUEST['id'];
            
            //try to drop the node
            try{
                //create tree handle
                $tree = new tree($this->db,'structure',$this->log);
                $tree->dropNode($id);
                
                //log action
                $this->log->recordAction("Ajax: Deleted node (".$id.")");
                
            //something went wrong
            }catch(exception $e){
                //log error
                $this->log->recordError($e->getMessage());

                //do nothing
            }
            
			$this->r->html = $this->smarty->preFetch('ajax'.DIRECTORY_SEPARATOR.'dropNode.html');
        }
    }
?>